<?php

namespace App\Library\Traits;

use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\DB;

trait AdminControllerTrait
{
    /**
     * detail
     * @param string $message
     * @return RedirectResponse
     */
    public function backWith(string $message): RedirectResponse
    {
        //admin_error('提示', $message);
        admin_toastr($message, 'error');
        return back()->withInput(request()->all());
    }

    public function shopCategory(): array
    {
        return DB::table('shop_category')->pluck('category_name', 'category_id')->toArray();
    }
}
